<template>
  <div>
    <el-card>
      <MyTable :loading="queryLoading" :cols="cols" :data="list">
        <template v-slot:level="{ row: { level } }">
          <el-tag :type="colors[level]">{{ levels[level] }}级</el-tag>
        </template>
      </MyTable>
    </el-card>
  </div>
</template>

<script>
import { getRight } from "@/api/user";
export default {
  data() {
    return {
      levels: ["一", "二", "三"],
      colors: ["", "success", "warning"],
      cols: [
        {
          title: "#",
          type: "index",
        },
        {
          title: "权限名称",
          name: "authName",
        },
        {
          title: "路径",
          name: "path",
        },
        {
          title: "权限等级",
          slot: "level",
        },
      ],
    };
  },
  created() {
    this.getRightList();
  },
  methods: {
    async getRightList() {
      try {
        this.queryLoading = true;
        this.list = await getRight();
      } catch (error) {}
      this.queryLoading = false;
    },
  },
};
</script>

<style scoped >
</style>
